package com.sicaolong.eventdefine.model.impl;

import com.sicaolong.eventdefine.model.Event;
import com.sicaolong.eventdefine.model.Receiver;
import com.sicaolong.eventdefine.model.Sender;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component("scl.local.sender")
public class LocalSender implements Sender {

    private static final Logger logger = LoggerFactory.getLogger(LocalSender.class);
    @Resource(name = "scl.local.receiver")
    private Receiver receiver;

    @Override
    public void send(Event event) {
        logger.warn("调用了本地事件发送器，事件类型是 {}", event.getType());
        receiver.handle(event);
    }
}
